package com.study.a05tcpdemo1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class Sever {
    public static void main(String[] args) throws IOException {

        //创建serverSocket对象
        ServerSocket ss=new ServerSocket(9000);

        //监听客户端连接
        Socket socket=ss.accept();

        /*InputStream is=socket.getInputStream();
        InputStreamReader ISR=new InputStreamReader(is);*/
        BufferedReader br=new BufferedReader(new InputStreamReader(socket.getInputStream()));
        int b;
        while((b=br.read())!=-1){
            System.out.print((char)b);
        }

        //关闭socket
        socket.close();
        ss.close();

    }
}
